var singleton = function () {
  // 私有变量和函数
  var privateVariable = 10
  function privateFunction() {
    return false
  }
  // 特权方法和属性
  return {
    publicProperty: true,
    publicMethods: function () {
      privateVariable++
      return privateFunction()
    }
  }
}()

// 增强的模块模式 适合那种规定了某些单例必须是某种类型的实例
var singleton = function () {
  var privateVariable = 10
  function privateFunction() {
    return false
  }
  // 创建对象
  var object = new Object()
  object.publicProperty = true
  object.publicMethods = function () {
    privateVariable++
    return privateFunction()
  }
  return object
}()
